wayland: Don't send invalid anchor rectangles
authorMatthias Clasen <mclasen@redhat.com>
Sun, 9 Aug 2020 20:00:19 +0000 (16:00 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 9 Aug 2020 20:02:25 +0000 (16:02 -0400)
When we send an anchor rectangle with a width or
height of 0, mutter reponds with "Invalid anchor
rectangle size". So, don't do that.

This was seen as sudden disappearance of gtk4-demo
when you click the fishbowl benchmark all the way
through to the menubuttons.

Fixes: #3027
gdk/wayland/gdksurface-wayland.c

index 46dd4a328402eb08c4540ba9f1402f2c9b7d622d..a7ecb7b19be28ade31c4443e43da7f98647123de 100644 (file)
@@ -2318,8 +2318,8 @@ create_dynamic_positioner (GdkSurface     *surface,
   real_anchor_rect_x = anchor_rect->x - parent->shadow_left;
   real_anchor_rect_y = anchor_rect->y - parent->shadow_top;
 
-  anchor_rect_width = anchor_rect->width;
-  anchor_rect_height = anchor_rect->height;
+  anchor_rect_width = MAX (anchor_rect->width, 1);
+  anchor_rect_height = MAX (anchor_rect->height, 1);
 
   gdk_popup_layout_get_offset (layout, &rect_anchor_dx, &rect_anchor_dy);